package operator.function.do_;

import io.reactivex.Observable;
import io.reactivex.functions.Consumer;
import util.Printer;
import util.RxJavaHelper;

class DoOnErrorOperator {

    public static void main(String[] args) {
        doOnError();
    }

    static void doOnError() {
        Observable.error(new RuntimeException("测试错误"))
                .doOnError(new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        Printer.print("doOnError throwable = " + throwable);
                    }
                })
                .subscribe(RxJavaHelper.getConsumer());
    }


}
